package com.example.demo.util;


import java.io.*;
import java.util.List;
import java.util.Map;

/**
 * list工具类
 * @author yby
 * @date 2022/9/28 19:37
 */
public class ListUtil {

    public static List<Map<String, Object>> deepCopyMapList(List<Map<String, Object>> src) throws IOException, ClassNotFoundException{
        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(byteOut);
        out.writeObject(src);

        ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
        ObjectInputStream in =new ObjectInputStream(byteIn);
        List dest = (List)in.readObject();
        return dest;
    }
//
//    public static List<BizObject> deepCopyBizList(List<BizObject> src) throws IOException, ClassNotFoundException{
//        ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
//        ObjectOutputStream out = new ObjectOutputStream(byteOut);
//        out.writeObject(src);
//
//        ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
//        ObjectInputStream in =new ObjectInputStream(byteIn);
//        List<BizObject> dest = (List<BizObject>)in.readObject();
//        return dest;
//    }
}
